﻿#ifndef COMSERVERSTATUSWIDGET_H
#define COMSERVERSTATUSWIDGET_H

#include <QGroupBox>
#include <QLabel>
#include <QMap>
#include <QVBoxLayout>
#include <QComboBox>

class ComServerOneStatusWidget : public QWidget
{
    Q_OBJECT
public:
    explicit ComServerOneStatusWidget(const QString& name = "",QWidget *parent = nullptr);
    void setText(const QString& status);
    void updateConnectList(const QStringList& listClient);
private:
    QLabel* lblStatus;
    QComboBox* cbboxConnectList;
};

class ComServerStatusWidget : public QGroupBox
{
    Q_OBJECT
public:
    explicit ComServerStatusWidget(const QString& name = "", QWidget *parent = nullptr);

    void addOne(QString name);
    void removeOne(QString name);
    void setStatus(QString name, QString status);
    void updateConnectList(QString name, const QStringList& listClient);
signals:
private:
    QMap<QString, ComServerOneStatusWidget*> mMapWgtComServerStatus;
    QVBoxLayout* mLayout;
};

#endif // COMSERVERSTATUSWIDGET_H
